package tp.pr2;

public class Fuel extends Item{
    private int power;
	private int times;
	
	public Fuel(java.lang.String id,java.lang.String description,int power, int times)
	{
		super(id,description);
		this.power=power;
		this.times=times;
	}
	
	public boolean use(RobotEngine r, Place p)
	{
	 	if( !this.canBeUsed()) return false;
	 	r.addFuel(this.power);
	 	if(r.getFuel()<0)r.addFuel(-r.getFuel());
	 	System.out.println(r.statsToString());
	 	this.times--;
	 	return true;	 		
	}
	
	public boolean canBeUsed()
	{
	 return times>0;
	}
	
	public java.lang.String toString()
	{
	 return super.toString()+
			 "power = "+
			 power+
			 ", times = "+
			 times;
	}
}
